fix-selection-rendering
authorDebian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org>
Thu, 15 Aug 2019 14:15:39 +0000 (15:15 +0100)
committerDmitry Shachnev <mitya57@debian.org>
Thu, 15 Aug 2019 14:15:39 +0000 (15:15 +0100)
Gbp-Pq: Name fix-selection-rendering.patch

src/gui/text/qtextlayout.cpp

index 6e824b2ed17af57648f25fc21ab0ace0d49aa95d..ed2a418f52f0c9cfe844af5b1f51ee1f26c335e9 100644 (file)
@@ -1006,10 +1006,8 @@ static void addSelectedRegionsToPath(QTextEngine *eng, int lineNumber, const QPo
             }
 
             if (lastSelectionWidth > 0) {
-                QRectF rect = boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight);
-                rect.moveLeft(qFloor(rect.left()));
-                rect.moveTop(qFloor(rect.top()));
-                region->addRect(rect);
+                const QRectF rect = boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight);
+                region->addRect(rect.toAlignedRect());
             }
 
             lastSelectionX = selectionX;
@@ -1017,10 +1015,8 @@ static void addSelectedRegionsToPath(QTextEngine *eng, int lineNumber, const QPo
         }
     }
     if (lastSelectionWidth > 0) {
-        QRectF rect = boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight);
-        rect.moveLeft(qFloor(rect.left()));
-        rect.moveTop(qFloor(rect.top()));
-        region->addRect(rect);
+        const QRectF rect = boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight);
+        region->addRect(rect.toAlignedRect());
     }
 }
 
@@ -2135,7 +2131,7 @@ static void setPenAndDrawBackground(QPainter *p, const QPen &defaultPen, const Q
 
     QBrush bg = chf.background();
     if (bg.style() != Qt::NoBrush && !chf.property(SuppressBackground).toBool())
-        p->fillRect(QRectF(qFloor(r.x()), qFloor(r.y()), r.width(), r.height()), bg);
+        p->fillRect(r.toAlignedRect(), bg);
     if (c.style() != Qt::NoBrush) {
         p->setPen(QPen(c, 0));
     }